﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using DataForest.DataModel;

namespace DataForest.View.Converter
{
    class ColumnToEntropyConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Node selectedNode = null;
            DataColumn column = null;
            foreach (object value in values)
            {
                if (value is Node)
                {
                    selectedNode = value as Node;
                }

                if (value is DataColumn)
                {
                    column = value as DataColumn;
                }
                
            }

            if (selectedNode != null && column != null)
            {
                return selectedNode.GetEntropie(column).ToString("0.00");
            }
            return "";
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
